package com.imu.genia;

/**
 * @Author genia
 * @Date 2022/5/13
 **/
public class ReflectionDirector {
    public static void main(String[] args) {
        IApplicationContext iac = new IClassPathXmlApplicationContext("applicationContext.xml");
        /**
         * 构造方法注入
         *  <constructor-arg name="geli" ref="geli"/>
         */
        System.out.println("0.构造方法注入：");
        MoAttack moAttack1 = (MoAttack) iac.getBean("moAttackConstructor");
        moAttack1.cityGateAsk();
        /**
         * 属性注入
         * <property name="geli"><ref bean="geli"/></property>
         */
        System.out.println("1.属性注入：");
        MoAttack moAttack = (MoAttack) iac.getBean("moAttackProperty");
        moAttack.cityGateAsk();
        /**
         * 工厂类注入
         * <bean id="moAttackFactory" factory-bean="beanFactory" factory-method="moAttackLiuDeHua" />
         */
        System.out.println("2.工厂类注入：");
        MoAttack moAttack2 = (MoAttack) iac.getBean("moAttackFactory");
        moAttack2.cityGateAsk();
    }
}
